#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  2 11:59:06 2018

@author: chenliheng
"""

f = open('tzp.txt','r')
"""
str1 = f.read(20)
print(str1,end="")

str2 = f.read()
print(str2)
"""

# windows通过记事本编辑文本文件，换行是"\r\n"，其它系统中"\n"
lines = f.readlines()
for l in lines:
    print(l.replace('\n',''))

f.close()


# 读取文本转换成大写，并且写入新upper.txt文件中
f1 = open('tzp.txt','r')
f2 = open('upper.txt','w')
content = f1.read()
content = content.upper()
f2.write(content)

f1.close()
f2.close()

# 英文字符属于ASCII码，'a'~'z' 97~122  'A'~'Z' 65~90
print(chr(65)) # 数值转换成SACII字符
print(ord('Z')) # 字符转换unicode数值
print(ord('中'))
